Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix quoting in zsh configuration instructions #998

Merged
merged 1 commit into from
Nov 15, 2023

Conversation

benweint
Copy link
Contributor

@benweint benweint commented Nov 15, 2023

rtx is an amazing tool, thank you for it!

The configuration instructions emitted by the installation script for configuring zsh don't work as written if you don't have ZDOTDIR set. I think this is a regression that was introduced recently by the changes in #963, which added the quotes, presumably to accommodate the case where ZDOTDIR includes spaces or other shell special characters.

Here's what the instructions currently look like when you install for zsh:

rtx: installing rtx...
rtx: installed successfully to /Users/ben/.local/share/rtx/bin/rtx
rtx: run the following to activate rtx in your shell:
echo "eval \"\$(/Users/ben/.local/share/rtx/bin/rtx activate zsh)\"" >> "~/.zshrc"

rtx: this must be run in order to use rtx in the terminal
rtx: run `rtx doctor` to verify this is setup correctly

Trying to run this line:

echo "eval \"\$(/Users/ben/.local/share/rtx/bin/rtx activate zsh)\"" >> "~/.zshrc"

... results in this:

zsh: no such file or directory: ~/.zshrc

... because of the fact that ~ doesn't get expanded within double-quotes. The zsh manual says:

If ZDOTDIR is unset, HOME is used instead.

... so this change falls back to $HOME in the case where $ZDOTDIR is unset.

@benweint
Copy link
Contributor Author

benweint commented Nov 15, 2023

Ah, actually I don't think this will work because of the fact that the installation script seems to be rendered via envsubst somewhere not on the user's machine. Let me think on it more. Never mind, I think this will work, because the invocation of envsubst here explicitly specifies which env vars to expand!

@jdx jdx enabled auto-merge (squash) November 15, 2023 03:42
@jdx jdx disabled auto-merge November 15, 2023 03:42
@benweint
Copy link
Contributor Author

(Updated the description here with more detail after finding #963, which I think introduced this issue!)

@jdx jdx enabled auto-merge (squash) November 15, 2023 16:16
@jdx
Copy link
Owner

jdx commented Nov 15, 2023

Thanks!

Copy link

codecov bot commented Nov 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4f1927c) 87.44% compared to head (cfb909a) 87.44%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #998   +/-   ##
=======================================
  Coverage   87.44%   87.44%           
=======================================
  Files         132      132           
  Lines       11684    11684           
=======================================
  Hits        10217    10217           
  Misses       1467     1467           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jdx jdx merged commit 4888335 into jdx:main Nov 15, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants